package com.bnz.controller;


import com.bnz.pojo.Student;
import com.bnz.pojo.Student2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

//@Controller 的衍生注解 : 处理 Http 请求
@RestController
//路由请求 可以设置各种操作方法
@RequestMapping
public class HelloController {

    @Autowired
    private DataSource dataSource;

    @Autowired
    private Student student;

    @Autowired
    private Student2 student2;

    //GET方法的路由
    @GetMapping("hello")
    public String hello(){
        return "hello,spring boot :"+dataSource;
    }

    @GetMapping("getStudent")
    public Student getStudent(){
        return student;
    }

    @GetMapping("getStudent2")
    public Student2 getStudent2(){
        return student2;
    }
}
